package com.jk.dao;

import com.jk.pojo.PayLog;
import com.jk.pojo.PayUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * Created by XSJ on 2017/12/26.
 */
public interface PayUserWalletDao {
    /**提现余额到银行卡  减少余额 李亚峰*/
    @Update(" update pay_user set userBalance = userBalance-#{money} where userAccount = #{useraccount} ")
    int rechargeToReduceUserBalanc(@Param("money") Double money,@Param("useraccount")String useraccount);

    /**提现到银行卡 银行卡金额增加 李亚峰*/
    @Update(" update pay_bank set bankMoney = bankMoney + #{money} where bankNum = #{bankNum}")
    int rechargeToAddBankMoney(@Param("money")Double money,@Param("bankNum")String bankNum);


    /**查询用户所有信息  包括用户余额 李亚峰*/
    @Select(" select * from pay_user where userAccount = #{useraccount} ")
    PayUser queryUserBalance(String useraccount);

    @Insert(" insert into pay_log(logId,logType,logInfo,saveTime,dealAmont,logSuccess,runNumber,userId,operatorId , logStatus )"+
            " values ( #{logId},#{logType},#{logInfo},#{saveTime},#{dealAmont},#{logSuccess},#{runNumber},"+
            " #{userId},#{operatorId},#{logStatus} ) ")
    void rechargeAddLog(PayLog log);
}
